package com.liu.dao;

import com.liu.entity.User;
import com.liu.utils.jdbcUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class UserDao {
    private QueryRunner runner = new QueryRunner(jdbcUtils.getDataSource());

    public List<User> findAll() throws SQLException {
        String sql="select u_id id,u_name name,u_acc acc,u_pass pass from t_user";
        return runner.query(sql,new BeanListHandler<>(User.class));
    }
}
